package com.blog.wl2023.repository;

import com.blog.wl2023.entity.Article;
import com.blog.wl2023.entity.Caprice;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author wule
 * @desc
 */
@Repository
public interface CapriceRepository extends JpaRepository<Caprice, Long> , JpaSpecificationExecutor<Caprice> {

	@Modifying
	@Transactional
	@Query("update Caprice a set a.isDelete=:isDelete where a.uuid = :uuid")
	void updateCapriceIsDelete(String uuid, Integer isDelete);

	@Query("SELECT a FROM Caprice a WHERE a.uuid = :uuid")
	Caprice findByUUid(String uuid);


	@Modifying
	@Transactional
	@Query("update Caprice a set a.capriceContent=:capriceContent where a.uuid = :uuid")
	void updateCaprice(String uuid, String capriceContent);
}
